package com.dhcc.bpm.modules.sandbox.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dhcc.bpm.common.text.Convert;
import com.dhcc.bpm.modules.sandbox.entity.SandboxCaseDict;
import com.dhcc.bpm.modules.sandbox.mapper.SandboxCaseDictMapper;
import com.dhcc.bpm.modules.sandbox.service.ISandboxCaseDictService;
import com.dhcc.bpm.modules.sandbox.vo.SandboxCaseDictVO;
import com.dhcc.bpm.modules.sandbox.vo.TestDictTypeVO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName SandboxCaseDictServiceImpl
 * @Description 沙箱案例测试关联表 服务实现类
 * @Author sjm
 * @Date 2020/2/21 0021 15:16
 * @Version V1.0
 * @Copyright: 2020 东华软件 . All rights reserved.
 **/
@Service
public class SandboxCaseDictServiceImpl extends ServiceImpl<SandboxCaseDictMapper, SandboxCaseDict> implements ISandboxCaseDictService {

	/**
	 * 自定义分页
	 * @Author sjm
	 * @Date 18:18 2020/2/21 0021
	 * @param page
	 * @param sandboxCaseDict
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.dhcc.bpm.modules.sandbox.vo.SandboxCaseDictVO>
	 **/
	@Override
	public IPage<SandboxCaseDictVO> selectSandboxCaseDictPage(IPage<SandboxCaseDictVO> page, SandboxCaseDictVO sandboxCaseDict) {
		return page.setRecords(baseMapper.selectSandboxCaseDictPage(page, sandboxCaseDict));
	}

	/**
	 * 根据实例id查询沙箱案例
	 * @Author sjm
	 * @Date 18:18 2020/2/21 0021
	 * @param page
	 * @param testDictTypeVO
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.dhcc.bpm.modules.sandbox.vo.TestDictTypeVO>
	 **/
	@Override
	public IPage<TestDictTypeVO> selectSandboxCaseByCaseId(IPage<TestDictTypeVO> page, TestDictTypeVO testDictTypeVO) {
		return page.setRecords(baseMapper.selectSandboxCaseByCaseId(page, testDictTypeVO));
	}

	/**
	 * 根据实例id查询集合
	 * @Author sjm
	 * @Date 18:19 2020/2/21 0021
	 * @param page
	 * @param testDictTypeVO
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.dhcc.bpm.modules.sandbox.vo.TestDictTypeVO>
	 **/
	@Override
	public IPage<TestDictTypeVO> selectByCaseId(IPage<TestDictTypeVO> page,TestDictTypeVO testDictTypeVO) {
		return page.setRecords(baseMapper.selectByCaseId(page, testDictTypeVO));
	}

	/**
	 * 查询沙箱实例
	 * @Author sjm
	 * @Date 18:19 2020/2/21 0021
	 * @param caseId
	 * @return java.util.List<com.dhcc.bpm.modules.sandbox.vo.SandboxCaseDictVO>
	 **/
	@Override
	public List<SandboxCaseDictVO> selectSandboxCase(Long caseId) {
		return baseMapper.selectSandboxCase(caseId);
	}

	/**
	 * 根据id查询沙箱实例
	 * @Author sjm
	 * @Date 18:19 2020/2/21 0021
	 * @param caseId
	 * @param testId
	 * @return com.dhcc.bpm.modules.sandbox.vo.SandboxCaseDictVO
	 **/
	@Override
	public SandboxCaseDictVO selectSandboxCaseById(Long caseId, Long testId) {
		return baseMapper.selectSandboxCaseById(caseId, testId);
	}

	/**
	 * 批量删除
	 * @Author sjm
	 * @Date 18:19 2020/2/21 0021
	 * @param caseId
	 * @param ids
	 * @return int
	 **/
	@Override
	public int removeByIds(long caseId, String ids) {
		return baseMapper.removeByIds(caseId, Convert.toLongArray(ids));
	}

}
